package com.maxima.maximaAttendance.daos;

import org.hibernate.HibernateException;
import org.hibernate.Session;

import com.maxima.maximaAttendance.utils.HibernateUtils;

public class AdminDAO {

	public boolean checkLogin(String uname,String pass)
	{
		Session session = HibernateUtils.getSession();
		session.beginTransaction();
		int x=0;
		try {
			x = session.createQuery("select a from Administrator a where a.username= '" + uname + "' and password= '" + pass + "'").list().size();
		} catch (HibernateException e) {
			e.printStackTrace();
			session.getTransaction().rollback();
		}
		session.getTransaction().commit();
		session.close();
		return (x>0);
	}
}
